﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Query2Object
{
    /// <summary>
    /// store the schema data for code generate
    /// 存储schema
    /// </summary>
    public class ColumnProperty
    {
        /// <summary>
        /// Column Name of DataTable
        /// 列名
        /// </summary>
        public string ColumnName { get; set; }
        /// <summary>
        /// Data Column's DataType
        /// 用数值表示的数据列类型（其实也就是枚举的值）
        /// </summary>
        public int TypeNumber { get; set; }
        /// <summary>
        /// Property's Datatype in program
        /// 实体字段的类型（string或者int之类）
        /// </summary>
        public string DataType { get; set; }
        /// <summary>
        /// if is Primary Key
        /// 是否是主键
        /// </summary>
        public bool IsKey { get; set; }
        /// <summary>
        /// if is auto upgrede
        /// 是否是自增字段（表示不能插入数据）
        /// </summary>
        public bool IsAuto { get; set; }

        /// <summary>
        /// print schema result,this method used for test
        /// </summary>
        /// <returns>schema infomation</returns>
        public override string ToString()
        {
            return ColumnName + "|" + TypeNumber + "|" + DataType + "|" + IsKey + "|" + IsAuto;
        }
    }
}
